package com.health.fallback;

import com.health.pojo.Product;
import com.health.pojo.User;
import com.health.remote.ProductRemote;
import org.springframework.stereotype.Component;

/**
 * client-product服务提供者的备选响应-熔断器hystrix响应
 * 实现搭桥的remote接口
 */
@Component
public class ProductRemoteFallBack implements ProductRemote {
    @Override
    public String getProductById(Integer id) {
        System.out.println("进入client-product熔断器..getProductById方法异常");
        System.out.println("熔断器接收到的productId:"+id);
        return "熔断器获得的productID:"+id;
    }

    @Override
    public Product getProductById2(Integer id, User user) {
        System.out.println("进入client-product熔断器..getProductById方法异常");
        System.out.println("熔断器接收到的productId:"+id);
        System.out.println("熔断器接收到的user:"+user);

        Product product = new Product(id, "熔断器获取的product对象", 1D);
        return product;
    }
}
